package com.jbl.gof23.create.builder;

/**
 * 指挥者，负责指挥构建一个对象，对象如何构建由他决定
 */
public class Director {
    //按照具体的顺序执行
    public Product build(Builder builder){
        builder.buildA();
        builder.buildB();
        builder.buildC();
        builder.buildD();

        return builder.getProduct();
    }

    /**
     * 测试
     */
    public static void main(String[] args) {
        Director director = new Director();
        Product build = director.build(new Worker());
        System.out.println(build.toString());
    }
}
